function ActivityAction(days, activity) {
    this._days = days;
    this._activity = activity;
}

ActivityAction.prototype = {
    apply: function(repository, recordHistoryCallback) {
        var monthsToSave = this._getMonthsToSave();
        recordHistoryCallback(monthsToSave);

        this._setActivity();
        repository.markAsChanged(monthsToSave);
    },

    applyUI: function(calendarViewBody) {
        calendarViewBody.updateDays(this._days);
    },

    _setActivity: function() {
        var me = this;
        this._days.foreach(function(day) {
            day.setActivity(me._activity);
            day.setSecondActivity(DayActivity.empty);
        });
    },
    _getMonthsToSave: function() {
        var months = [];
        this._days.foreach(function(day) {
            months.uniquePush(day.parentMonth());
        });
        return months;
    }
};
